﻿<UserControl x:Class="Flipbook.Controls.CanvasSubsetControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
             xmlns:InputInteractivity="http://schemas.microsoft.com/expression/2010/interactions"
             xmlns:Behaviors="clr-namespace:Flipbook.Behaviors"
             mc:Ignorable="d"
             d:DesignHeight="300"
             d:DesignWidth="300"
             x:Name="UserControl"
             Height="350"
             Width="110"
             BorderBrush="{x:Null}"
             BorderThickness="0">
    <Border BorderThickness="0.5,0,1,0"
            BorderBrush="{DynamicResource VerticalFadingBorderBrush}">
        <Border BorderThickness="0,0,0,1"
                BorderBrush="{DynamicResource FadingBorderBrush}">
            <DockPanel>
                <TextBlock Text="Canvas"
                           FontSize="14"
                           DockPanel.Dock="Top"
                           Height="24"
                           VerticalAlignment="Center"
                           HorizontalAlignment="Stretch"
                           TextAlignment="Center"
                           Background="{DynamicResource RibbonBackgroundBrush}"/>
                <Button Height="24"
                        Width="100"
                        DockPanel.Dock="Bottom"
                        VerticalAlignment="Bottom"
                        HorizontalAlignment="Stretch"
                        Background="{DynamicResource RibbonBackgroundBrush}"
                        Command="{Binding Path=PreviewCommand}">
                        Preview
                </Button>
                <ListBox x:Name="CanvasListBox"
                         ItemsSource="{Binding CanvasViewModels}"
                         SelectedItem="{Binding ActiveCanvasViewModel}"
                         ScrollViewer.HorizontalScrollBarVisibility="Hidden"
                         ScrollViewer.VerticalScrollBarVisibility="Hidden"
                         BorderThickness="0">
                    <ItemsControl.ItemTemplate>
                        <DataTemplate>
                            <Border BorderThickness="0.25"
                                    BorderBrush="Black"
                                    Width="100"
                                    Height="100">
                                <Border.Background>
                                    <VisualBrush Visual="{Binding Canvas}" />
                                </Border.Background>
                            </Border>
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                </ListBox>
            </DockPanel>
        </Border>
        <i:Interaction.Behaviors>
            <InputInteractivity:TranslateZoomRotateBehavior SupportedGestures="Translate"
                                                            TranslateFriction="0.5"
                                                            ConstrainToParentBounds="True" />
        </i:Interaction.Behaviors>
    </Border>
</UserControl>
